import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

extension RouterHelper on BuildContext {
  Future<T?> page<T extends Object?>(
    String url, {
    Object? extra,
  }) {
    var data = Uri.encodeComponent(url);
    return push('/web?url=$data&closable=false', extra: extra);
  }

  void web<T extends Object?>(
    String url, {
    Object? extra,
  }) {
    var data = Uri.encodeComponent(url);
    go('/web?url=$data&closable=true', extra: extra);
  }
}
